package com.test10;

import org.junit.Test;

@FunctionalInterface
interface IMessage {
    public void send(String msg);
}

@FunctionalInterface
interface ICompare<T> {
    public int compare(T t1, T t2);
}

public class MyTest_01 {

    @Test
    public void test1() {
        IMessage message = (msg) -> System.out.println("【发送消息】" + msg);
        message.send("www.baidu.com");
    }

    @Test
    public void test2() {
        ICompare<String> strCompare = (t1, t2) -> t1.compareTo(t2);
        System.out.println(strCompare.compare("baidu", "BAIDU"));

        ICompare<Integer> intCompare = (t1, t2) -> t1.compareTo(t2);
        System.out.println(intCompare.compare(211, 985));
    }
}
